package com.feng.eduservice.controller;


import com.feng.commonutils.R;
import com.feng.eduservice.entity.EduComment;
import com.feng.eduservice.service.EduCommentService;
import com.feng.eduservice.service.EduCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 评论 前端控制器
 * </p>
 *
 * @author fengge
 * @since 2023-03-29
 */
@RestController
@RequestMapping("/eduservice/educomment")
@CrossOrigin
public class EduCommentController {
   @Autowired
    private EduCommentService eduCommentService;
   //根据课程id 分页查询课程评论的方法
   @GetMapping("/getCommentPage/{page}/{limit}/{courseId}")
    public R getCommentPage(@PathVariable Long page, @PathVariable Long limit, @PathVariable String courseId){
       return eduCommentService.getCommentPage(page,limit,courseId);
   }
   @PostMapping("/auth/addComment")
    public R addComment(HttpServletRequest request, @RequestBody EduComment eduComment){
       return eduCommentService.addComment(request,eduComment);
   }
}

